class LibraryDepartmentsController < ApplicationController
  # GET /library_departments
  # GET /library_departments.xml
  def index
    @library_departments = LibraryDepartment.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @library_departments }
    end
  end

  # GET /library_departments/1
  # GET /library_departments/1.xml
  def show
    @library_department = LibraryDepartment.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @library_department }
    end
  end

  # GET /library_departments/new
  # GET /library_departments/new.xml
  def new
    @library_department = LibraryDepartment.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @library_department }
    end
  end

  # GET /library_departments/1/edit
  def edit
    @library_department = LibraryDepartment.find(params[:id])
  end

  # POST /library_departments
  # POST /library_departments.xml
  def create
    @library_department = LibraryDepartment.new(params[:library_department])

    respond_to do |format|
      if @library_department.save
        flash[:notice] = 'LibraryDepartment was successfully created.'
        format.html { redirect_to(@library_department) }
        format.xml  { render :xml => @library_department, :status => :created, :location => @library_department }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @library_department.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /library_departments/1
  # PUT /library_departments/1.xml
  def update
    @library_department = LibraryDepartment.find(params[:id])

    respond_to do |format|
      if @library_department.update_attributes(params[:library_department])
        flash[:notice] = 'LibraryDepartment was successfully updated.'
        format.html { redirect_to(@library_department) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @library_department.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /library_departments/1
  # DELETE /library_departments/1.xml
  def destroy
    @library_department = LibraryDepartment.find(params[:id])
    @library_department.destroy

    respond_to do |format|
      format.html { redirect_to(library_departments_url) }
      format.xml  { head :ok }
    end
  end
end
